﻿using GC_FFW.ForecastWriterClient.Abstractions.Interfaces.Factories.ViewModel;
using GC_FFW.ForecastWriterClient.ViewModels;
using GC_FFW.ForecastWriterClient.ViewModels.Parameters;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Builders;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Factories;

namespace GC_FFW.ForecastWriterClient.Factories.ViewModel
{
	public class MatchDataEditorViewModelFactory : IMatchDataEditorViewModelFactory
	{
		#region Variables

		private readonly IForecastDataBuilder _forecastDataBuilder;
		private readonly ISoccerfameDataHelperFactory _soccerfameDataHelperFactory;

		#endregion

		#region Constructors

		public MatchDataEditorViewModelFactory(IForecastDataBuilder forecastDataBuilder, ISoccerfameDataHelperFactory soccerfameDataHelperFactory)
		{
			_forecastDataBuilder = forecastDataBuilder;
			_soccerfameDataHelperFactory = soccerfameDataHelperFactory;
		}

		#endregion

		#region IMatchDataEditorViewModelFactory Members

		public MatchDataEditorViewModel Create(MatchDataEditorViewModelParameters parameters)
		{
			if (parameters != null)
			{
				parameters.ForecastDataBuilder = _forecastDataBuilder;
				parameters.SoccerfameDataHelperFactory = _soccerfameDataHelperFactory;
			}

			return new MatchDataEditorViewModel(parameters);
		}

		#endregion
	}
}